/**
 *  @file StreamWriter.h
 */
#ifndef _STREAMWRITER_H_
#define _STREAMWRITER_H_

#include "Writer.h"
#include "../text/UTFCharConv.h"

namespace cppflib
{

// forward declaration
namespace collections { 
   class BinBuf;
}

namespace io
{

class Stream;

/**
 *  Write characters to a stream
 */
class _DLLAPI StreamWriter : public Writer
{
private:
    Stream *pOrgStream;
    text::charset_t targetCharSet;
    collections::BinBuf *pTempBuf;
    collections::ArrayByte *pTempArray;

private:
    StreamWriter(void);

public:	
    StreamWriter(Stream *pStream, text::charset_t targetCharSet);
	virtual ~StreamWriter(void);

    virtual void Close();
    virtual void Flush();
    virtual void Write(collections::ArrayWChar &buffer);
    virtual void Write(collections::ArrayWChar &buffer, int offset, int count);
    virtual void Write(const CFString &str);
    virtual void Write(const CFString &str, int offset, int count);
    virtual void Write(int c);
};

} // end of namespace io

} // end of namespace cppflib


#endif
